import time

from DrissionPage import Chromium
from yy_验证码.超级鹰 import PostPic

tab = Chromium().latest_tab
tab.get("https://bm.ruankao.org.cn/sign/in?type=query&s=query/score/main")
to_login = tab.ele('x=//*[@class="change_login"]')
time.sleep(2)
to_login.click()
username = tab.ele('x=//*[@placeholder="请输入证件号码"]')
username.input('admin')
password = tab.ele('x=//*[@placeholder="请输入密码"]')
password.input('123456')
login_btn = tab.ele('x=//div[@class="tncode"]')
login_btn.click()
time.sleep(3)
click_move = tab.ele('x=//div[@class="slide_block"]')
click_move.click()
location = click_move.rect
print(location.x)
img = tab.ele('x=//*[@class="tncode_canvas_mark"]')
time.sleep(3)
img.get_screenshot('./imgs/软考.png')
img_bytes = img.get_screenshot(as_bytes=True)
ret = PostPic(img_bytes,9901)
x = int(ret['pic_str'].split(',')[0])-25
time.sleep(2)
click_move.drag_to((100, 0))
time.sleep(3)
login = tab.ele('x=//div[@class="layui-form-item t_center"]')
login.click()
